package com.springboot.websocket;

import javax.websocket.HandshakeResponse;
import javax.websocket.server.HandshakeRequest;
import javax.websocket.server.ServerEndpointConfig;

public class CORSConfigurator extends ServerEndpointConfig.Configurator {
    @Override
    public boolean checkOrigin(String origin) {
        return true; // 允许所有来源
    }

    @Override
    public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response) {
        System.out.println("modifyHandshake");
    }
}